package com.qzy.reggie.mapper;

import com.qzy.reggie.pojo.Category;
import com.qzy.reggie.pojo.Employee;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface LppCategoryMapper {

    @Select("select * from category")
    List<Employee> selectList();

    @Insert("insert into category (type,name,sort,create_time,update_time,create_user,update_user) values (#{type},#{name},#{sort},#{createTime},#{updateTime},#{createUser},#{updateUser})")
    Integer insert(Category category);


    @Update("<script>" +
            "update category <set>" +
            "<if test='name != null'>name = #{name},</if>" +
            "<if test='sort != null'>sort = #{sort}</if>" +
            "</set>" +
            "</script>")
    Integer update(Category category);

    @Select("select * from category where id = #{id}")
    Category selectOne(Category category);
}
